Skip to content

Attempted to fix #141972 Parameter ABI inconsistency error in Rust for RISC-V #141979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

YingkaiLi-VM
Copy link

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Jun 3, 2025

r? @fee1-dead

rustbot has assigned @fee1-dead.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 3, 2025
@rustbot

This comment has been minimized.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 3, 2025
@rust-log-analyzer

This comment has been minimized.

@workingjubilee
Copy link
Member

r? @workingjubilee

sorry for not reviewing your PR yet, @beetrees, but can you check if this would overlap with #139340

@rustbot rustbot assigned workingjubilee and unassigned fee1-dead Jun 3, 2025
@beetrees
Copy link
Contributor

beetrees commented Jun 3, 2025

This is unrelated: #139340 is about structs with floating point fields passed via the "C" ABI, whereas #141972 is about integers being passed with the "Rust" ABI.

@workingjubilee
Copy link
Member

@YingkaiLi-VM please rebase on the current master branch

@workingjubilee workingjubilee removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 4, 2025
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot

This comment has been minimized.

@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 5, 2025
@bors
Copy link
Collaborator

bors commented Jun 9, 2025

☔ The latest upstream changes (presumably #142220) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 9, 2025
@rustbot

This comment has been minimized.

@rustbot rustbot added the has-merge-commits PR has merge commits, merge with caution. label Jun 11, 2025
@rustbot rustbot removed has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 11, 2025
@YingkaiLi-VM
Copy link
Author

@bors @workingjubilee Okay,Merge conflicts resolved. Thanks for your help!

@jieyouxu
Copy link
Member

@rustbot review

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 15, 2025
@jieyouxu jieyouxu added the O-riscv Target: RISC-V architecture label Jun 15, 2025
@@ -7,6 +7,9 @@
//@ normalize-stderr: "(valid_range): [1-9]\.\.=(429496729[0-9]|1844674407370955161[0-9])" -> "$1: $$NON_NULL"
// Some attributes are only computed for release builds:
//@ compile-flags: -O
//@ revisions: generic riscv64
//@ [riscv64] only-riscv64
Copy link
Member

@workingjubilee workingjubilee Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make this a cross-compiling test?

See this for an example of what that looks like: 6cea550

You will also want to add something like this:

//@ add-core-stubs
#![feature(no_core)]
#![no_core]

extern crate minicore;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If using this approach:​​

#![feature(no_core)]
#![no_core]

extern crate minicore;

The code will fail to compile with the error: ​​the trait bound str: Sized is not satisfied​​.

​​If using this approach (conditional compilation comments):​​

//@ revisions: generic riscv64
//@ [riscv64] compile-flags: --target riscv64gc-unknown-linux-gnu
//@ [riscv64] needs-llvm-components: riscv

This test will ​​only apply to the target riscv64gc-unknown-linux-gnu​​.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@workingjubilee I'm not sure if my understanding is correct, but personally, I believe this particular test itself is intended to be a generic test. Thanks.

Copy link
Member

@workingjubilee workingjubilee Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test can only be blessed if it is cross-compiled. Changes to the specifics of rustc's internals will make this test fail and then, because we do not run tests on riscv targets, we will not run this revision of this test, and it will fall out of sync.

You need //@ add-core-stubs to make the minicore crate compiled with it.

And "str is not Sized" is already a part of the test output:

error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/debug.rs:57:46
|
LL | type TestAbiEqNonsense = (fn((str, str)), fn((str, str)));
| ^^^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `str`
= note: only the last element of a tuple may have a dynamically sized type

That is already an error.

Copy link
Member

@workingjubilee workingjubilee Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am happy to accept the PR you are currently offering but I need you to understand that you are signing yourself up for this test instead potentially breaking in a new way every time you update rustc and run the tests on your RV64 host. As opposed to now, where it will just be broken in this same way every time.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, thanks for your help. I'll look into how to fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-riscv Target: RISC-V architecture S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants